package com.zhuss.excecise.processor;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zhuss.bean.vo.excecise.excecise.DetailExceciseAppendVo;
import com.zhuss.exception.ExceptionCode;
import com.zhuss.exception.WpsException;
import com.zhuss.excecise.db.dao.ext.ExceciseAppendDao;


/**
 * 查询练习生Append processor
 * @Author: zhushanshuo
 * @Date: 2019/9/24 19:54
 */
@Component("exceciseAppendRead")
public class ExceciseAppendRead {
	
	@Autowired
	private ExceciseAppendDao exceciseAppendDao;
	
	
	public List<DetailExceciseAppendVo> listByType(Integer type, Long exceciseId, Long creatorId) {
		List<DetailExceciseAppendVo> list = exceciseAppendDao.listByType(type, exceciseId, creatorId);
		return list;
	}
	
	public DetailExceciseAppendVo getByType(Integer type, Long exceciseId, Long creatorId) {
		DetailExceciseAppendVo result = exceciseAppendDao.getByType(type, exceciseId, creatorId);
		return result;
	}
	
	/**
	 * 练习生Append详情
	 * @param exceciseAppendId
	 * @return
	 * @throws WpsException
	 */
	public Object detail(Long exceciseAppendId) throws WpsException {
		Object result = exceciseAppendDao.detail(exceciseAppendId);
		if (result == null) {
			throw new WpsException(ExceptionCode.数据不存在);
		}
		return result;
	}
	
	

}
